﻿namespace Bowlus.Common
{
    using System.Linq;
    using System.Net;
    using Microsoft.WindowsAzure.ServiceRuntime;

    public class Helper
    {
        public static string HostIpAddress
        {
            get
            {
                if (RoleEnvironment.IsEmulated)
                {
                    return "127.255.0.0";
                }

                return Dns.GetHostAddresses(Dns.GetHostName())
                    .First(ip => ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork).ToString();
            }
        }
    }
}
